from pptx import Presentation
from pptx.util import Inches

ppt = Presentation()
slide = ppt.slides.add_slide(ppt.slide_layouts[1])
# 插图
left = Inches(5)
top = Inches(2)
width = Inches(3)
height = Inches(3)
pic = slide.shapes.add_picture('苦短.jpg', left, top, width, height)

# 插表
rows = 2
cols = 2
left = Inches(1)
top = Inches(3)
width = Inches(4)
height = Inches(4)
table = slide.shapes.add_table(rows, cols, left, top, width, height).table
table.columns[0].width = Inches(1)
table.columns[1].width = Inches(3)
table.cell(0,0).text = '1'  # 插入文本必须是字符串形式
table.cell(0,1).text = '2'
table.cell(1,0).text = '3'
table.cell(1,1).text = '4'

ppt.save('test_图和表.pptx')